package com.day0426.point;/*
 * @创建者：黄苟苟
 * @创建时间：2021/4/26   18:36
 * @Description描述
 **/

import java.util.Scanner;

public class PointDemo {
    Point p1;
    Point p2;

    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        System.out.println("请输入第一个点横坐标");
        double x1 =scanner.nextDouble();
        System.out.println("请输入第一个点纵坐标");
        double y1=scanner.nextDouble();
        System.out.println("请输入第二个点横坐标");
        double x2 =scanner.nextDouble();
        System.out.println("请输入第二个点纵坐标");
        double y2=scanner.nextDouble();
        Point p1=new Point(x1,y1);
        Point p2=new Point(x2,y2);

        PointDemo pointDemo=new PointDemo(p1,p2);
        pointDemo.distance();


    }

    private void distance() {

            Double a=Math.sqrt(Math.abs(p1.getX()-p2.getX())*Math.abs(p1.getX()-p2.getX())+Math.abs(p1.getY()-p2.getY())*Math.abs(p1.getY()-p2.getY()));
            System.out.println(a);
        }


    public PointDemo(Point p1, Point p2) {
        this.p1 = p1;
        this.p2 = p2;
    }

    @Override
    public String toString() {
        return super.toString();
    }
}
